package com.kuaiying.utils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FileUtils {

	public static List<String> getFiles(String filePath) {
		List<String> filelist = new ArrayList<String>();
		File root = new File(filePath);
		File[] files = root.listFiles();
		for (File file : files) {
			if (file.isDirectory()) {
				/*
				 * 递归调用
				 */
				getFiles(file.getAbsolutePath());
			} else {
				filelist.add(file.getName());
			}
		}
		return filelist;
	}
	
	public static void main(String[] args) {
		List<String> files = FileUtils.getFiles("D:\\docin\\edudown\\unrar\\");
		
		for (String string : files) {
			System.out.println( string );
		}
	}
}
